﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace kinect_music_shooter.GameWorld
{
    class Tunnel2 : GameObject
    {
        public override void Draw(GraphicsDevice graphicsDevice, Camera camera)
        {
            for (int i = 0; i < 30; i++)
            {
                foreach (ModelMesh mesh in model.Meshes)
                {
                    foreach (BasicEffect effect in mesh.Effects)
                    {
                        effect.EnableDefaultLighting();
                        effect.PreferPerPixelLighting = true;

                        effect.World =
                            Matrix.CreateFromYawPitchRoll(
                            rotation.Y,
                            rotation.X,
                            rotation.Z) *

                            Matrix.CreateScale(scale) *

                            Matrix.CreateTranslation(position);


                        effect.DirectionalLight0.DiffuseColor = new Vector3(0.1f, 0.1f, 0.1f); // a red light
                        effect.DirectionalLight0.Direction = new Vector3(5, -5, -10);  // coming along the x-axis
                        effect.DirectionalLight0.SpecularColor = new Vector3(1, 0, 0); // with red highlights
                        effect.AmbientLightColor = new Vector3(0.2f, 0.2f, 0.2f);
                        effect.EmissiveColor = new Vector3(0.2f, 0.2f, 0.2f);

                        effect.Projection = camera.Projection;
                        effect.View = camera.View;

                        effect.FogEnabled = true;
                        effect.FogStart = 0.0f;
                        effect.FogEnd = 700.0f;
                        effect.FogColor = new Vector3(0.0f, 0.0f, 0.0f);
                    }
                    mesh.Draw();
                    position.Z += 50.0f;
                }
            }
            position.Z = 0;
        }
    }
}
